<template>
  <view class="whole">
    <view>
      <view class="detailwhole" v-if="detail != null">
        <view class="detailtitle">
          <text>{{ detail.title }}</text>
        </view>
        <view class="detailtime">
          <text>{{ detail.created_at }}</text>
        </view>
        <rich-text :nodes="content" style="color: #ffffff;"></rich-text>
        <!-- <parser :html="about_us"></parser> -->
      </view>
    </view>
  </view>
</template>

<script>
import api from "../../api/api";
export default {
  data() {
    return {
      id: "",
      content: null,
      detail: null,
    };
  },
  onLoad(option) {
    this.id = option.id;
    this.details();
  },
  methods: {
    async details() {
      let res = await api.zixundetails({
        method: "get",
        // loading: '加载中',
        query: {
          id: this.id,
        },
      });
      if (res.code == 0) {
        res.data.details = res.data.details.replace(
          /\<img/g,
          "<img style='width: 100%;'"
        );
        this.detail = res.data;
        this.content = this.detail.details.replace(
          /\<p/g,
          "<p style='color:#ffffff'"
        );
      }
    },
  },
};
</script>

<style lang="scss" scoped>
@import "../../style/yuanchuang.scss";
.whole {
  width: 100%;
  height: 100%;
  background-color: $bg-color1;
  min-height: 100vh;
  .detailwhole {
    display: flex;
    flex-direction: column;
    margin: 0 30rpx;
    .detailtitle {
      color: $text-color1;
      font-weight: 500;
      font-size: 32rpx;
      padding-top: 20rpx;
      text-align: center;
    }
    .detailtime {
      font-weight: 400;
      color: $text-color1;
      font-size: 24rpx;
      padding: 20rpx 0 30rpx;
    }
    .detailcontent {
      font-weight: 400;
      color: $text-color1;
      font-size: 28rpx;
      padding-top: 30rpx;
    }
    .detailcover {
      width: 690rpx;
      height: 460rpx;
      padding-top: 20rpx;
    }
  }
}
</style>
